#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>

extern int etext, edata, end; /*对应文本的第一有效地址、初始化的数据*/

int main() {
  printf("before fork:\netext:%6p \t edata:%6p \t end:%6p \n", &etext, &edata,
         &end);
  pid_t pid;
  if ((pid = fork())) {
    wait(NULL);
  } else {
    printf("\nafter fork, in child:\netext:%6p \t edata:%6p \t end:%6p \n",
           &etext, &edata, &end);
    printf("\nin child, running another program:\n");
    execl("./10-2", "", NULL);
  }
  return 0;
}